// var isPalindrome = function (x) {
//   let str = x.toString()
//   let arr = str.split('')    //{'1','2','3','2',1''}
//   let newArr = arr.reverse()
//   let newStr = newArr.join('')   //'12321'
//   return str === newStr
// };

// console.log(isPalindrome(12321))  //true

let str = 'yeseydadsd'
var isPalindrome = function (x) {
  let str = x.toString()
  for (let i = 0, j = str.length - 1; i < j; i++, j--) {
    if (str[i] !== str[j]) {
      return false
    }
  }
  return true
}

console.log(isPalindrome(x));

